package intgrafica.principal;

import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class TelaAvaliacao extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.telaavaliacao);
		Button cadastrarmedidas = (Button) findViewById(R.id.button15);
		cadastrarmedidas.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				Intent it = new Intent(TelaAvaliacao.this,
						TelaCadastrarMedidas.class);
				startActivity(it);
			}
		});
		Button acompanhamento = (Button) findViewById(R.id.button16);
		acompanhamento.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				Intent it = new Intent(TelaAvaliacao.this,
						TelaAcompanhamentoProgresso.class);
				startActivity(it);
			}
		});
		
		Button deletarMedidas = (Button) findViewById(R.id.button18);
		deletarMedidas.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				SQLiteDatabase bancoDeDados;
				try {
					bancoDeDados = openOrCreateDatabase("banco", MODE_WORLD_READABLE,
							null);
					String SQL = "DELETE FROM medidas;";
					bancoDeDados.execSQL(SQL);
					bancoDeDados.close();
					Toast.makeText(getApplicationContext(), "Medidas apagadas!", Toast.LENGTH_SHORT).show();
				} catch(Exception e) {
					
				}
			}
		});
		Button voltar = (Button) findViewById(R.id.button17);
		voltar.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				finish();
			}
		});
	}
	
	private void startGraphActivity(Class<? extends Activity> activity) {
		Intent intent = new Intent(TelaAvaliacao.this, activity);
		startActivity(intent);
	}

}
